package cn.edu.scau.cmi.linhuanrui.client;

import java.util.Scanner;

import cn.edu.scau.cmi.linhuanrui.composite.safe.*;

public class SafeCompositeClient {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		SafeTeam root = new SafeTeam("组织");

		System.out.println("请输入创建的个人的名字：");
		SafePerson person1 = new SafePerson(scanner.nextLine());

		System.out.println("请输入创建的团队的名字：");
		SafeTeam team = new SafeTeam(scanner.nextLine());

		System.out.println("请输入创建的团队的成员名字：");
		SafePerson teamPerson1 = new SafePerson(scanner.nextLine());

		System.out.println("请输入创建的团队的成员名字：");
		SafePerson teamPerson2 = new SafePerson(scanner.nextLine());

		System.out.println("请输入创建的个人的名字：");
		SafePerson person2 = new SafePerson(scanner.nextLine());

		System.out.println("请输入创建的个人的名字：");
		SafePerson person3 = new SafePerson(scanner.nextLine());

		root.addChild(person1);
		team.addChild(teamPerson1);
		team.addChild(teamPerson2);
		root.addChild(team);
		root.addChild(person2);
		root.addChild(person3);

		root.show(0);

		System.out.println();
		System.out.println("删除最后创建的个人后：");
		root.deleteChild(person3);
		root.show(0);	
	}

}
